package com.rslai.base.tool.servertest.config;

import com.rslai.base.tool.servertest.annotation.ConfigElement;
import com.rslai.base.tool.servertest.annotation.Property;
import com.rslai.base.tool.servertest.command.SqlStepCommand;
import com.rslai.base.tool.servertest.command.StepCommand;
import com.rslai.base.tool.servertest.model.KeyValueStore;

import java.util.Arrays;

@ConfigElement(defaultProperty = "sql")
public class SqlStepConfig extends StepConfig {
    public static final String SQL = "sql";
    public static final String DATABASE = "database";

    @Property(required = true)
    String sql;

    @Property(defaultValue = "default")
    String database;

    public StepCommand createCommand() {
        return new SqlStepCommand(Arrays.asList(new KeyValueStore[]{new KeyValueStore("sql", this.sql), new KeyValueStore("database", this.database)}));
    }
}
